<%--
 *  File:    OrgEditOther.jsp
 *  @Author: Michael Zhao 
 *  Date:    2002/11/20
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
 

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.CurrencyCode");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "OGM";
  	String strTableName = "ovorgaddition";
	String privilegeCode = "10101";
	  String contextPath = request.getContextPath(); 
  	//get current userinfo
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  	cat.debug("The userinfo is :"+CurUserInfo);
  	cat.info("enter my page");

%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>OrgEditOther</title>
<PageFlow:CheckPageFlow pageName="orgaddition"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/Calendar.js"></script>

<script>
function page_save()
{
	    
	    if(!checkForm(document.cform))return;
	    if(!formatDate(document.cform))return;

        emptyToNull(document.cform);
   //     changedic1();
        cform.actionname.value="save";
        cform.target="_self";
         __submitData("pageform",true);
         
}
function changedic1(){
    var arrAll=document.cform.getElementsByTagName('select');
    for(i=0;i <arrAll.length;i++)
    {
         var obj1 = arrAll[i];
        var obj2 = eval("cform."+arrAll[i].name+"4save");
       obj2.value = obj1.options[obj1.selectedIndex].text;
        obj2.name = arrAll[i].name;
        obj1.name = arrAll[i].name+"_tmp";


    }



}

function setdefalutdic(objstr,objItemText){
     var obj = eval("cform."+objstr);
     var isExit = false;
    for (var i = 0; i < obj.options.length; i++) {

        if (obj.options[i].value == objItemText) {
            obj.options[i].selected = true;
            isExit = true;
            break;
        }
    }

    //Show����
    if (isExit) {
       return;
    } else {
         obj.options[0].selected = true;
    }

}
</script>
<%
    
	Integer OrgId = null;
	String readMode = "";
    boolean isDisabled=false;
    if(pageContext.getAttribute("orgid")!=null)
	{
	  OrgId = (Integer)pageContext.getAttribute("orgid");
	}
    if(pageContext.getAttribute("hospitalid")!=null)
	{
	  OrgId = (Integer)pageContext.getAttribute("hospitalid");
	}
    if(pageContext.getAttribute("pharmacyid")!=null)
	{
	  OrgId = (Integer)pageContext.getAttribute("pharmacyid");
	}
	HashMap orgaddition = (HashMap)pageContext.getAttribute("orgaddition");
	if(orgaddition == null)
	{
		orgaddition = new HashMap();
	}
	if(request.getParameter("info")!=null)
	{
	  readMode = (String)request.getParameter("info");
	  if(readMode.equalsIgnoreCase("Y"))
	  {
	    readMode = "readonly";
         isDisabled=true;
      }
	  else
	  {
	   readMode = "";
      isDisabled=false;
      }
	  
	}
	String strDisplayFlag="";
	if(request.getParameter("displayflag")!=null)
	{
	  strDisplayFlag=request.getParameter("displayflag");
	 
	}
     
%>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
 Vector details = (Vector)pageContext.getAttribute("details");
  if(details == null) details = new Vector();
    int i=0;
%>
<form id="pageform" name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
  <input type="hidden" name="pagename" value="orgaddition">
  <input type="hidden" name="actionname"> 
  <input type="hidden" name="orgid" value="<%=JspHelper.filterNull( OrgId)%>"> 
  <input type="hidden" name="hospitalid" value="<%=JspHelper.filterNull( OrgId)%>"> 
  <input type="hidden" name="pharmacyid" value="<%=JspHelper.filterNull( OrgId)%>"> 
  <input type="hidden" name="numrows" value="<%=JspHelper.filterNull( details.size() )%>">
          
  <table border=0 cellpadding=0 cellspacing=0 width="100%">
  <tr> 
    <td> 
      <table border=0 cellpadding=0 cellspacing=0 width="100%">
        <tbody> 
        <tr> 
          <td> 
            <table border=1 cellpadding=0 cellspacing=0 width="100%">
              <tr> 
                <td> 
                  <div id=div1 style="HEIGHT: 350px; OVERFLOW: auto">
                    <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" width="100%">
                      <tr> 
                        <td class="deepblue-left" colspan="4"><img src="<%=contextPath %>/images/<%= strLanguageCode %>/quote.gif"> 
                          <%= label.getLabelName("L_AdditionalInfo")+ label.getLabelName("L_Colon") %>
                        </td>
                      </tr>
   <!--from table AdditionalCaption-->
                        <tr>
                         <logic:iterate id="onerow" collection="<%= details %>" indexId="idx">
                               <%
                               HashMap  myrow=(HashMap)onerow;
                               int attrtype=((Integer)myrow.get("attrtype")).intValue();
                               boolean isDict = "Y".equals(myrow.get("isdict").toString());
                               String DictType=(String)myrow.get("dicttype");
                               String AttrName=((String)myrow.get("attrname")).trim().toLowerCase();
                               String Attrvalue = (String)orgaddition.get(AttrName);
                               %>

                           <%if(i%2==0){%>

                        <td class="td-text" width="110"><custom:write name="onerow" property="captionname" nbsp="true" /><%= label.getLabelName("L_Colon") %></td>
                         <%if(isDict){ %>
                         <td> <custom:selectdic  name="orgaddition" property="<%=AttrName%>" sortOrder="desc" dictType="<%=DictType%>" defaultValue="--------" />
                         <input type="hidden" name="<%=AttrName%>4save">
                             <script>
                             setdefalutdic("<%=AttrName%>","<%=Attrvalue%>");
                         </script>
                         </td>
                       <%}if((attrtype==1&&!isDict&&DictType==null)||(attrtype==2&&!isDict&&DictType==null)){ %>
                         <td><custom:text name="orgaddition" property="<%=AttrName%>" readonly="<%= isDisabled%>"/></td>

                          <%}if(attrtype==3||"Date".equals(DictType)){%>
                           <td><custom:text name="orgaddition" property="<%=AttrName%>" size="20" dataType="date" dataFormatName="dateformat" module="OGM" label="L_Date" readonly="<%= isDisabled%>" />
                               <%if(!isDisabled){%>
                          <a onclick="show_calendar('cform.<%=JspHelper.filterNull(AttrName)%>','MM-dd-yyyy')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a></td>
                             <%}}} else {%>

                        <td class="td-text" width="110"><custom:write name="onerow" property="captionname" nbsp="true" /><%= label.getLabelName("L_Colon") %></td>
                          <%if(isDict){ %>
                         <td> <custom:selectdic  name="orgaddition" property="<%=AttrName%>" sortOrder="desc" dictType="<%=DictType%>" defaultValue="--------" disabled="<%= isDisabled%>" />
                         <input type="hidden" name="<%=AttrName%>4save">
                             <script>
                             setdefalutdic("<%=AttrName%>","<%=Attrvalue%>");
                         </script>
                         </td>
                       <%}if((attrtype==1&&!isDict&&DictType==null)||(attrtype==2&&!isDict&&DictType==null)){ %>
                         <td><custom:text name="orgaddition" property="<%=AttrName%>" readonly="<%= isDisabled%>" /></td>
                          <%}if(attrtype==3||"Date".equals(DictType)){%>
                           <td><custom:text name="orgaddition" property="<%=AttrName%>" size="20" dataType="date" dataFormatName="dateformat" module="OGM" label="L_Date" readonly="<%= isDisabled%>" />
                              <%if(!isDisabled){%>
                          <a onclick="show_calendar('cform.<%=JspHelper.filterNull(AttrName)%>','MM-dd-yyyy')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a></td>
                            <%}}%>
                       </tr><tr>
                             <%}
                         i++;%>

                      </logic:iterate>
                         <%if(i%2==1){%> <td class="td-text">&nbsp</td><td>&nbsp</td><%}%>
                        </tr>
                  

                    </table>
                      <td><custom:hidden name="orgaddition"  property="orgadditionalattributeid" /></td>
                  </div>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        </tbody> 
      </table>
    </td>
  </tr>
  <tr> 
    <td class=summary_top></td>
  </tr>
  <tr> <td class=td_center height="39">
   	<%if((strDisplayFlag).equals("view")){%>
			&nbsp;
		<%}else{ %>
	<a onclick="page_save();"><custom:button type="2" label="L_Save" imgsrc="save.gif" border="0" style="width:60"/></a>
	<%}%>
	<a onclick="__back()"><custom:button type="2" label="L_Back" imgsrc="delete.gif" border="0" style="width:60"/></a></td>
  </tr>
</table>
</form>
</body>
</html>



